<template>
  <el-aside class="sidebar" width="auto">
    <router-link
      class="logo"
      :to="{ name: 'Home' }"
      title="Back to Home"
      :class="{ collapse: sidebar.collapse }"
    >
      <img src="../assets/logo1.png" alt="edu_home" />
      <h1>EDU_HOME</h1>
    </router-link>
    <el-menu :collapse="sidebar.collapse">
      <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>教育业务</span>
          </template>      
              <el-menu-item>课程管理</el-menu-item>
      </el-submenu>
    </el-menu>
  </el-aside>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["sidebar"]),
  },
};
</script>

<style>
.sidebar {
  position: sticky;
  top: 0;
  max-height: 100vh;
  user-select: none;
  background: #fff;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-track {
  border-radius: 2em;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 2em;
}

.logo {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  color: #495057;
  line-height: 50px;
  text-decoration: none;
  text-align: center;
}

.logo:hover {
  color: #343a40;
  background-color: rgba(0, 0, 0, 0.05);
}

.logo.collapse h1 {
  width: 0;
}

.logo h1 {
  display: inline-block;
  margin: 0px;
  width: 130px;
  overflow: hidden;
  font-size: 20px;
  white-space: nowrap;
  transition: width 0.3s;
}

.logo img {
  margin: 10px;
  width: 30px;
}
</style>